package com.ithe.shopweb.config;


import com.ithe.shopweb.component.JwtInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 功能： 拦截对象进行判别放行
 * 日期： 2024/4/7 17:09
 */

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor( jwtInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**", "/person/**", "/home/offerQuery", "/home/offerSearch");
    }

    @Bean
    public JwtInterceptor jwtInterceptor() {
       return new JwtInterceptor();
    }
}
